const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')

const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
  mode: 'development',
  // mode: 'production',
  entry: './src/main.js',
  devtool: 'cheap-module-source-map',
  output: {
    filename: 'index.js',
    path: path.resolve(__dirname, './dist'),
  },
  module: {
    rules: [
      {
        // 排除下面的文件夹
        test: /\.vue$/,
        exclude: /(node_modules|bower_components)/,
        use: ['vue-loader']
      },
      {
        test: /\.js$/,
        use: {
          loader: 'babel-loader',
        },
      },
    ],
  },
  plugins: [new CleanWebpackPlugin(), new htmlWebpackPlugin({
    template: './index.html'
  }), new VueLoaderPlugin()],
}
